#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf8')
from PyQt4.QtGui import *
from PyQt4.QtCore import *

class WorkWin(QWidget):
    def __init__(self, parent = None):
        QWidget.__init__(self, parent)
        
        #self.setStyleSheet('QWidget{margin:2cm 4cm 3cm 4cm;}')
        self.conf = dict()
        self.mainLayout = QVBoxLayout()
        self.setMaximumHeight(400)
        self.setFixedSize(QSize(640,400))
        
        hBox = QHBoxLayout()
        self.queueLabel = MyLabel(u'地址队列长度: 0')
        hBox.addWidget(self.queueLabel)
        hBox.addStretch()
        self.mainLayout.addLayout(hBox)
        
        hBox = QHBoxLayout()
        self.dealLabel = MyLabel(u'已处理地址: 0')
        hBox.addWidget(self.dealLabel)
        hBox.addStretch()
        self.mainLayout.addLayout(hBox)
        
        hBox = QHBoxLayout()
        self.curUrlLabel = MyLabel(u'当前处理地址:')
        hBox.addWidget(self.curUrlLabel)
        hBox.addStretch()
        self.mainLayout.addLayout(hBox)
        
        hBox = QHBoxLayout()
        hBox.addStretch()
        self.statusLabel = MyLabel(u'状态: 终止')
        self.startBtn = QPushButton(u'开始')
        self.pauseBtn = QPushButton(u'暂停')
        self.stopBtn = QPushButton(u'终止')
        hBox.addWidget(self.statusLabel)
        hBox.addStretch()
        hBox.addWidget(self.startBtn)
        hBox.addWidget(self.pauseBtn)
        hBox.addWidget(self.stopBtn)
        self.mainLayout.addLayout(hBox)
        
        self.setLayout(self.mainLayout)

        self.connect(self.startBtn, SIGNAL('clicked()'), self.startClicked)
    def startClicked(self):
        self.startBtn.setEnabled(False)
        self.statusLabel.setText(u'状态：开始')

class MyLabel(QLabel):
    def __init__(self, text):
        QLabel.__init__(self, text)
        self.setMinimumSize(120, 20)
        self.setMaximumSize(120, 20)

if __name__ == '__main__':
    import sys
    app = QApplication(sys.argv)
    configwin = WorkWin()
    configwin.show()
    sys.exit(app.exec_())